/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package libPackage;

import jade.core.behaviours.CyclicBehaviour;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;

/**
 *
 * @author duonghau
 */
public class RequestDie extends CyclicBehaviour{
        @Override
        public void action(){
            MessageTemplate messageTemplate=MessageTemplate.and(MessageTemplate.MatchPerformative(ACLMessage.CFP), MessageTemplate.MatchOntology("requestdie"));                
            ACLMessage messageQuestion=myAgent.receive(messageTemplate);
            if(messageQuestion!=null){
                myAgent.doDelete();
            }else{
                block();
            }             
        }     
}
